﻿namespace Hourglass.Qrobot
{
    public static class QrobotConsts
    {
        #region URL

        /// <summary>
        /// Referer1
        /// {0} referer version 1
        /// </summary>
        public const string URL_Referer1 = "http://s.web2.qq.com/proxy.html?v={0}&callback=1&id=1";

        /// <summary>
        /// Referer2
        /// {0} referer version 2
        /// </summary>
        public const string URL_Referer2 = "http://d1.web2.qq.com/proxy.html?v={0}&callback=1&id=2";

        /// <summary>
        /// 发送和接收消息时的Referer
        /// </summary>
        public const string URL_SendPollReferer = "https://d1.web2.qq.com/cfproxy.html?v=20151105001&callback=1";

        /// <summary>
        /// 获取登录二维码的请求
        /// {0} appid
        /// {1} 随机浮点数，小于一为佳
        /// </summary>
        public const string URL_GetLoginQRCode = "https://ssl.ptlogin2.qq.com/ptqrshow?appid={0}&e=0&l=M&s=5&d=72&v=4&t={1}";

        /// <summary>
        /// 获取登录二维码及二维码状态请求的Referer
        /// {0} appid
        /// </summary>
        public const string URL_LoginQRCodeReferer = "https://ui.ptlogin2.qq.com/cgi-bin/login?daid=164&target=self&style=16&mibao_css=m_webqq&appid={0}&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001";

        /// <summary>
        /// 获取登录二维码状态请求
        /// {0} appid
        /// {1} 随机5-6位数整数，该参数，每次请求都不一样，但不一定是随机数，暂定随机数看效果（2016-11-17 03:26:52）
        /// </summary>
        public const string URL_LoginQRCodeState = "https://ssl.ptlogin2.qq.com/ptqrlogin?webqq_type=10&remember_uin=1&login2qq=1&aid={0}&u1=http%3A%2F%2Fw.qq.com%2Fproxy.html%3Flogin2qq%3D1%26webqq_type%3D10&ptredirect=0&ptlang=2052&daid=164&from_ui=1&pttype=1&dumy=&fp=loginerroralert&action=0-0-{1}&mibao_css=m_webqq&t=undefined&g=1&js_type=0&js_ver=10180&login_sig=&pt_randsalt=0";

        /// <summary>
        /// 在QQ登录验证通过后，需要获取一些额外vfwebqq验证信息
        /// {0} clientid
        /// {1} 从cookie中读取ptwebqq
        /// {2} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_Getvfwebqq = "http://s.web2.qq.com/api/getvfwebqq?ptwebqq={1}&clientid={0}&psessionid=&t={2}";

        /// <summary>
        /// cookie键为ptwebqq的cookie所在的domain，只需要在*.qq.com下即可
        /// </summary>
        public const string DOMAN_Vfwebqq = "http://w.qq.com";

        /// <summary>
        /// 返回值包含pssessionid
        /// </summary>
        public const string URL_Psessionid = "http://d1.web2.qq.com/channel/login2";

        /// <summary>
        /// 获取pssessionid请求中所需要的数据，注意，需要进行urlencode
        /// {0} clientid
        /// {1} 从cookie中读取ptwebqq
        /// </summary>
        public const string PARA_Psessionid = "r={{\"ptwebqq\":\"{1}\",\"clientid\":{0},\"psessionid\":\"\",\"status\":\"online\"}}";

        /// <summary>
        /// 获取好友列表
        /// </summary>
        public const string URL_Friends = "http://s.web2.qq.com/api/get_user_friends2";

        /// <summary>
        /// 获取好友列表请求中POST的参数
        /// {0} 从之前一次请求的返回值中获取的vfwebqq
        /// {1} 根据QQ号和ptwebqq经过算法计算出来的hash
        /// </summary>
        public const string PARA_Friends = "r={{\"vfwebqq\":\"{0}\",\"hash\":\"{1}\"}}";

        /// <summary>
        /// 获取好友个人信息
        /// {0} 好友ID
        /// {1} vfwebqq
        /// {2} clientid
        /// {3} psessionid
        /// {4} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_FriendInfo = "http://s.web2.qq.com/api/get_friend_info2?tuin={0}&vfwebqq={1}&clientid={2}&psessionid={3}&t={4}";

        /// <summary>
        /// 获取QQ群组信息
        /// </summary>
        public const string URL_Groups = "http://s.web2.qq.com/api/get_group_name_list_mask2";

        /// <summary>
        /// 获取QQ群组信息请求中POST的参数
        /// {0} 从之前一次请求的返回值中获取的vfwebqq
        /// {1} 根据QQ号和ptwebqq经过算法计算出来的hash
        /// </summary>
        public const string PARA_Groups = "r={{\"vfwebqq\":\"{0}\",\"hash\":\"{1}\"}}";

        /// <summary>
        /// 获取单个QQ群信息
        /// {0} groupcode
        /// {1} vfwebqq
        /// {2} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_GroupInfo = "http://s.web2.qq.com/api/get_group_info_ext2?gcode={0}&vfwebqq={1}&t={2}";

        /// <summary>
        /// 获取讨论组信息
        /// {0} clientid
        /// {1} 从之前一次请求的返回值中获取的psessionid
        /// {2} 从之前一次请求的返回值中获取的vfwebqq
        /// {3} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_Disscuss = "http://s.web2.qq.com/api/get_discus_list?clientid={0}&psessionid={1}&vfwebqq={2}&t={3}";

        /// <summary>
        /// 获取单个讨论组详细信息
        /// {0} 讨论组ID
        /// {1} vfwebqq
        /// {2} clientid
        /// {3} psessionid
        /// {4} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_DisscussInfo = "http://d1.web2.qq.com/channel/get_discu_info?did={0}&vfwebqq={1}&clientid={2}&psessionid={3}&t={4}";

        /// <summary>
        /// 获取登录用户信息
        /// {0} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_OwnerInfo = "http://s.web2.qq.com/api/get_self_info2?t={0}";

        /// <summary>
        /// 获取最近联系人
        /// </summary>
        public const string URL_Recent = "http://d1.web2.qq.com/channel/get_recent_list2";

        /// <summary>
        /// 获取最近联系人请求中POST的参数
        /// {0} clientid
        /// {1} 从之前一次请求的返回值中获取的vfwebqq
        /// {2} 从之前一次请求的返回值中获取的psessionid
        /// </summary>
        public const string PARA_Recent = "r={{\"vfwebqq\":\"{1}\",\"clientid\":{0},\"psessionid\":\"{2}\"}}";

        /// <summary>
        /// 获取在线好友列表
        /// {0} clientid
        /// {1} 从之前一次请求的返回值中获取的vfwebqq
        /// {2} 从之前一次请求的返回值中获取的psessionid
        /// {3} 时间戳，从1970.1.1到现在的毫秒数
        /// </summary>
        public const string URL_OnlineFirends = "http://d1.web2.qq.com/channel/get_online_buddies2?vfwebqq={1}&clientid={0}&psessionid={2}&t={3}";

        /// <summary>
        /// 根据用户ID获取QQ号
        /// {0} QQ ID
        /// {1} vfwebqq
        /// {2} 时间戳，从1970.1.1到现在的毫秒数
        /// {3} 1为QQ个人 4位QQ群组
        /// </summary>
        public const string URL_GetAccountNumber = "http://s.web2.qq.com/api/get_friend_uin2?tuin={0}&type={3}&vfwebqq={1}&t={2}";

        /// <summary>
        /// poll请求，获取消息
        /// </summary>
        public const string URL_PollMessage = "https://d1.web2.qq.com/channel/poll2";

        /// <summary>
        /// poll请求参数
        /// {0} vfwebqq
        /// {1} clientid
        /// {2} psessionid
        /// </summary>
        public const string PARA_PollMessage = "r={{\"ptwebqq\":\"{0}\",\"clientid\":{1},\"psessionid\":\"{2}\",\"key\":\"\"}}";

        /// <summary>
        /// 发送个人消息
        /// </summary>
        public const string URL_SendPersonalMessage = "https://d1.web2.qq.com/channel/send_buddy_msg2";

        /// <summary>
        /// 发送群组消息 请求参数
        /// {0} 个人ID
        /// {1} 消息内容
        /// {2} 登录人face字段
        /// {3} clientid
        /// {4} messageid八位随机整数
        /// {5} psessionid
        /// </summary>
        public const string PARA_SendPersonalMessage = "r={{\"to\":{0},\"content\":\"[\\\"{1}\\\",[\\\"font\\\",{{\\\"name\\\":\\\"宋体\\\",\\\"size\\\":10,\\\"style\\\":[0,0,0],\\\"color\\\":\\\"000000\\\"}}]]\",\"face\":{2},\"clientid\":{3},\"msg_id\":{4},\"psessionid\":\"{5}\"}}";

        /// <summary>
        /// 发送群组消息
        /// </summary>
        public const string URL_SendGroupMessage = "https://d1.web2.qq.com/channel/send_qun_msg2";

        /// <summary>
        /// 发送群组消息 请求参数
        /// {0} 群组ID
        /// {1} 消息内容
        /// {2} 登录人face字段
        /// {3} clientid
        /// {4} messageid八位随机整数
        /// {5} psessionid
        /// </summary>
        public const string PARA_SendGroupMessage = "r={{\"group_uin\":{0},\"content\":\"[\\\"{1}\\\",[\\\"font\\\",{{\\\"name\\\":\\\"宋体\\\",\\\"size\\\":10,\\\"style\\\":[0,0,0],\\\"color\\\":\\\"000000\\\"}}]]\",\"face\":{2},\"clientid\":{3},\"msg_id\":{4},\"psessionid\":\"{5}\"}}";

        /// <summary>
        /// 发送讨论组消息
        /// </summary>
        public const string URL_SendDisscussMessage = "https://d1.web2.qq.com/channel/send_discu_msg2";

        /// <summary>
        /// 发送群组消息 请求参数
        /// {0} 讨论组ID
        /// {1} 消息内容
        /// {2} 登录人face字段
        /// {3} clientid
        /// {4} messageid八位随机整数
        /// {5} psessionid
        /// </summary>
        public const string PARA_SendDisscussMessage = "r={{\"did\":{0},\"content\":\"[\\\"{1}\\\",[\\\"font\\\",{{\\\"name\\\":\\\"宋体\\\",\\\"size\\\":10,\\\"style\\\":[0,0,0],\\\"color\\\":\\\"000000\\\"}}]]\",\"face\":{2},\"clientid\":{3},\"msg_id\":{4},\"psessionid\":\"{5}\"}}";

        #endregion URL

        #region Other

        public const string DefaulUserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36";

        public const string HttpPrefix = "http://";

        public const string HttpsPrefix = "https://";

        #endregion
    }
}
